package mcia_administrative;

import java.awt.Container;
import java.util.ArrayList;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;

/**
 * Main.java - starts the program and initializes variables.
 * 
 * @author MCIA
 */
public class Main {

    public static JPanel currentPanel;
    public static Container container;
    public static WelcomeScreen mainScreen;
    //below variables used as global so we can remember current project settings
    public static ArrayList<ArrayList<String[]>> allUnits = new ArrayList<ArrayList<String[]>>();       //CLs on the floors
    public static ArrayList<String> floorImages = new ArrayList<String>();                              //images of the floors
    public static ArrayList<String[]> allLights = new ArrayList<String[]>();                            //lights in CLs
    public static ArrayList<String> floorDescriptions = new ArrayList<String>();                        //descriptions of the floors
    public static ArrayList<Integer> freeFloorNumbers = new ArrayList<Integer>();                       //list with free floor numbers (when deleting some floors)
    public static ArrayList<String> globalSceneName = new ArrayList<String>();                          //keeping names of global scenes
    public static ArrayList<ArrayList<String[]>> globalScenes = new ArrayList<ArrayList<String[]>>();   //local scenes and their time here
    public static int floorComboIndex = 0;                                                              //remembering comboList position

    public static void main(String[] args) {
        //setting Windows Look and Feel
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (Exception ex) {
            System.out.println("Error setting native LAF: " + ex);
        }

        //initializing 0. floor for remembering list (so the numbers are good with floors)
        if (Main.allUnits.isEmpty()) {
            Main.allUnits.add(0, new ArrayList<String[]>());
        }
        if (Main.floorImages.isEmpty()) {
            Main.floorImages.add(0, "-");
        }
        if (Main.floorDescriptions.isEmpty()) {
            Main.floorDescriptions.add(0, "");
        }

        //showing first screen - logOn screen
        mainScreen = new WelcomeScreen();
        currentPanel = new JPanel();
        container = mainScreen.getContentPane();
        container.add(currentPanel);
        mainScreen.setVisible(true);
    }

    public static void changeFrame(JFrame c) {
        //method to change current frame
        container = c.getContentPane();
        mainScreen.setContentPane(container);
    }
}
